<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<center>
		<form action="{url:/smail/register}" method="post">
			<table>
				<tr>
					<td>用户名:</td>
					<td><input type="text" name="u_name"id="u_name"></td>
				</tr>
				<tr>
					<td>密码:</td>
					<td><input type="password" name="u_pwd"id="u_pwd"></td>
				</tr>
				<tr>
					<td>邮箱:</td>
					<td><input type="email" name="u_email"id="u_email"></td>
				</tr>
				<tr>
					<td><button id="btn">注册</button></td>
				</tr>
			</table>
		</form>
	</center>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
	$(document).on("click","#btn",function(){

		var u_name=$("#u_name").val();
		var u_pwd=$("#u_pwd").val();
		var u_email=$("#u_email").val();
		// alert(u_name);return;
		var a_email=/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
		if(u_email==""||u_name==""||u_pwd=="")
		{
          alert("输入内容不可以为空");
          return false;
		}
		if(!a_email.test(u_email))
		{
           alert("邮箱格式不正确");
           return false;
		}
		//y用form表单提交
		$("form").submit();
	})
</script>